import request from '../../../../../public/js/common/api/api.js';
// const FeedProductionUrl = Utils.CurDomain.FeedProductionUrl
// const FodderUrl = Utils.CurDomain.FodderUrl
const FodderUrl = 'https://dev.wg.ynsnjt.net/fodder/composite'
const SysPlfUrl = Utils.CurDomain.SysPlfUrl;
const AuthUrl = Utils.CurDomain.AuthUrl;
const configuration = {
	contentType: 'application/json',
	dataType: 'json',
	async: true,
	dataFilter(data, type) {
		return data;
	}
}

/**
 * @file 质检单
 */
export default class QualityInspectionApi {
	/**
	 * 获取当前用户拥有的组织
	 * @param 
	 * @returns 
	 */
	static getOrgsList() {
		return request.get(`${AuthUrl}/accounts/orgs`);
	}

	/**
	 * 获取质检单列表信息
	 * @param data
	 * @returns 
	 */
	static getList(data) {
		return request.post(`${FodderUrl}/inspectionrrders/plist`, data);
	}

	/**
	 * 创建质检单
	 * @param data
	 * @returns
	 */
	static createInspectionOrder(data) {
		return request.post(`${FodderUrl}/inspectionrrders`, data);
	}

	/**
	 * 更新质检单
	 * @param Id
	 * @param data
	 * @returns
	 */
	static updateInspectionOrder(Id, data) {
		return request.put(`${FodderUrl}/inspectionrrders/${Id}`, data);
	}

	/**
	 * 获取质检单详情
	 * @param Id
	 * @returns
	 */
	static getInspectionOrderDetails(Id) {
		return request.get(`${FodderUrl}/inspectionrrders/${Id}`);
	}

	/**
	 * 删除质检单
	 * @param Id
	 * @returns
	 */
	static deleteInspectionOrder(Id) {
		return request.delete(`${FodderUrl}/inspectionrrders/${Id}`);
	}

	/**
	 * 提交质检单
	 * @returns
	 * @param id
	 */
	static submitInspectionOrder(id) {
		return request.post(`${FodderUrl}/inspectionrrders/submit`, {
			id
		});
	}

	/**
	 * 反提交质检单
	 * @returns
	 * @param id
	 */
	static resubmitInspectionOrder(id) {
		return request.post(`${FodderUrl}/inspectionrrders/resubmit`, {
			id
		});
	}

	/**
	 * 审核质检单
	 * @param id
	 * @returns
	 */
	static auditInspectionOrder(id) {
		return request.post(`${FodderUrl}/inspectionrrders/audit`, {
			id
		});
	}

	/**
	 * 反审核质检单
	 * @param id
	 * @returns
	 */
	static reAuditInspectionOrder(id) {
		return request.post(`${FodderUrl}/inspectionrrders/reaudit`, {
			id
		});
	}

}